package com.idp.web.shop.service.impl;
import com.idp.web.shop.service.GoodsService;
import com.idp.web.shop.dao.GoodsDao;
import com.idp.web.shop.entity.Goods;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.idp.common.persistence.Page;
import com.idp.common.util.ResourceUtils;

/**
 * 
 * 商品信息service实现类
 * 
 * <pre>
 * 	历史记录：
 * 	2018-04-12 WuJiangWu
 * 	新建文件
 * </pre>
 * 
 * @author 
 * <pre>
 * SD
 * 	WuJiangWu
 * PG
 *	WuJiangWu
 * UT
 *
 * MA
 * </pre>
 * @version $Rev$
 *
 * <p/> $Id$
 *
 */
@Service("goodsService")
public class GoodsServiceImpl implements GoodsService {

	@Resource
	private GoodsDao goodsDao;
	
	@Override
	public Page<Goods> findByPage(Goods goods, Page<Goods> page) {

		page.setResult(goodsDao.find(goods, page));
		
		return page;
	}
	
	@Override
	public List<Goods> findBySearch(Goods goods) {

		return goodsDao.find(goods);
	}
	
	@Override
	public Goods getById(String id) {

		return goodsDao.getById(id);
	}

	@Override
	public void add(Goods goods) {

		goods.setId(ResourceUtils.getUUID());
		goodsDao.add(goods);
	}
	
	@Override
	public void update(Goods goods) {

		goodsDao.update(goods);
	}

	@Override
	public void delete(String id) {

		goodsDao.delete(id);
	}
 	
}